//
// Created by Administrator on 2023/8/1.
//
#include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>

using namespace std;


class Solution {
public:
    bool findSubarrays(vector<int> &nums) {
        int n = nums.size();
        unordered_map<int, int> um;
        for (int i = 0; i < n - 1; ++i) {
            int curSum = nums[i] + nums[i + 1];
            um[curSum]++;
            if (um[curSum] > 1) return true;
        }
        return false;
    }
};

class Solution2 {
public:
    bool findSubarrays(vector<int> &nums) {
        int n = nums.size();
        unordered_set<int> seen;
        for (int i = 0; i < n - 1; ++i) {
            int sum = nums[i] + nums[i + 1];
            if (seen.count(sum)) {
                return true;
            }
            seen.insert(sum);
        }
        return false;
    }
};

int main() {
    Solution s;
    vector<int> nums = {1, 1, 1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20};
    cout << s.findSubarrays(nums) << endl;
    return 0;
}
